﻿/*
 * Created by SharpDevelop.
 * User: xieen
 * Date: 2013-08-23
 * Time: 14:53
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;

namespace GoF23Learning._16.Oberver_Pattern.Refactor
{
	/// <summary>
	/// Description of Subject.
	/// </summary>
	public abstract class Subject
	{
		protected List<IOberver> oberverList = new List<IOberver>();
		
		public virtual  void AddOberver(IOberver oberver){
			oberverList.Add(oberver);
			
		}
		public virtual void RemoveOberver(IOberver oberver){
			oberverList.Remove(oberver);
		}
		protected virtual  void Notify(AccountArgs account)
		{
			foreach (IOberver oberver in oberverList) {
				oberver.Update(account);
			}						 
		}
	}
}
